home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / src / alib / csup / exec_support / NewList.asm < prev    next >
Assembly Source File  |  1994-02-16  |  1KB  |  49 lines

  1.  
  2. ******* amiga.lib/NewList *****************************************************
  3. *
  4. *   NAME
  5. *    NewList -- prepare a list structure for use
  6. *
  7. *   SYNOPSIS
  8. *    NewList(list)
  9. *
  10. *    VOID NewList(struct List *);
  11. *    VOID NewList(struct MinList *);
  12. *
  13. *   FUNCTION
  14. *    Perform the magic needed to prepare a List header structure for
  15. *    use; the list will be empty and ready to use.  (If the list is the
  16. *    full featured type, you may need to initialize lh_Type afterwards)
  17. *
  18. *    Assembly programmers may want to use the NEWLIST macro instead.
  19. *
  20. *   INPUTS
  21. *    list - pointer to a List or MinList.
  22. *
  23. *   SEE ALSO
  24. *    <exec/lists.h>
  25. *
  26. *******************************************************************************
  27.  
  28.         INCLUDE "exec/types.i"
  29.         INCLUDE    "exec/lists.i"
  30.  
  31.  
  32.         SECTION    _NewList
  33.         XDEF    _NewList
  34.         XDEF    @NewList
  35.  
  36. _NewList:    move.l    4(sp),a0    ;Get pointer from C's stack
  37.  
  38. ;This next code is equavalent to the NEWLIST macro (but faster)
  39. @NewList:
  40.         clr.l    LH_TAIL(a0)
  41.         move.l    a0,LH_TAILPRED(a0)
  42.         addq.l    #LH_TAIL,a0    ;pointer plus 4...
  43.         move.l    a0,-(a0)    ;...back down to LH_HEAD
  44.  
  45. ;;;;        move.l    a0,d0        :pass the list back in D0
  46.         rts
  47.  
  48.         END
  49.